﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/ViewPageAdmin.master" AutoEventWireup="true" CodeBehind="MainMenu.aspx.cs" Inherits="SiteLib.AdminPanel.MainMenu" %>

<%@ Import Namespace="SiteLib.Data" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphTitleContainer" runat="server">
    <asp:Label runat="server" ID="lblTitle" Text="Настройка главного меню" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphSubMenuContainer" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphContentContainer" runat="server">
    <div class="adminContent">
        <div class="fieldGrid">
            <div class="fieldEntry">
                <div class="fieldEntryControl">
                    <asp:Button runat="server" ID="btnAddNewMenuItem" Text="Добавить новый пункт меню" OnClick="btnAddNewMenuItem_Click" />
                </div>
            </div>
        </div>
    </div>
    <asp:MultiView runat="server" ID="mvMenu">
        <asp:View runat="server" ID="vMenu">
            <div class="adminContent">
                <div class="fieldGrid">
                    <div class="fieldEntry">
                        <h1>Пункты меню
                        </h1>
                    </div>
                </div>
            </div>
            <asp:Repeater runat="server" ID="rptMainMenu" OnItemCommand="rptMainMenu_OnItemCommand">
                <HeaderTemplate>
                    <asp:Literal runat="server" ID="lUlOpen" Text="<ul class='expandedMenu'>" />
                </HeaderTemplate>
                <ItemTemplate>
                    <li>
                        <div style="overflow: hidden;">
                            <div style="float: left;">
                                <asp:LinkButton runat="server" Text='<%# Eval("Title") %>' CommandName="EditMenuItem" CommandArgument='<%# Eval("SiteMenuItemId") %>' />
                            </div>
                            <div class="adminTableRowIconBlock">
                                <div class="adminTableRowIcon">
                                    <asp:LinkButton ID="btnDeleteMenuItem" runat="server" ToolTip='<%$ Resources:UserSite, resDelete %>'
                                        CommandName="DeleteMenuItem" CommandArgument='<%# Eval("SiteMenuItemId") %>' OnClientClick="return confirm('Подтвердите удаление')"
                                        CssClass="adminTableRowDelete" />
                                </div>
                            </div>
                        </div>
                        <asp:Repeater runat="server" ID="rptMainSub1Menu" DataSource='<%# ((SiteMenuItem)Container.DataItem).Childs %>' Visible='<%# ((SiteMenuItem)Container.DataItem).Childs.Count != 0 %>' OnItemCommand="rptMainMenu_OnItemCommand">
                            <HeaderTemplate>
                                <asp:Literal runat="server" ID="lSub1UlOpen" Text="<ul>" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <li>

                                    <div style="overflow: hidden;">
                                        <div style="float: left;">
                                            <asp:LinkButton runat="server" Text='<%# Eval("Title") %>' CommandName="EditMenuItem" CommandArgument='<%# Eval("SiteMenuItemId") %>' />
                                        </div>
                                        <div class="adminTableRowIconBlock">
                                            <div class="adminTableRowIcon">
                                                <asp:LinkButton ID="btnDeleteMenuItem" runat="server" ToolTip='<%$ Resources:UserSite, resDelete %>'
                                                    CommandName="DeleteMenuItem" CommandArgument='<%# Eval("SiteMenuItemId") %>' OnClientClick="return confirm('Подтвердите удаление')"
                                                    CssClass="adminTableRowDelete" />
                                            </div>
                                        </div>
                                    </div>
                                    <asp:Repeater runat="server" ID="rptMainSub2Menu" DataSource='<%# ((SiteMenuItem)Container.DataItem).Childs %>' Visible='<%# ((SiteMenuItem)Container.DataItem).Childs.Count != 0 %>' OnItemCommand="rptMainMenu_OnItemCommand">
                                        <HeaderTemplate>
                                            <asp:Literal runat="server" ID="lSub2UlOpen" Text="<ul>" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <li>
                                                <div style="overflow: hidden;">
                                                    <div style="float: left;">
                                                        <asp:LinkButton runat="server" Text='<%# Eval("Title") %>' CommandName="EditMenuItem" CommandArgument='<%# Eval("SiteMenuItemId") %>' />
                                                    </div>
                                                    <div class="adminTableRowIconBlock">
                                                        <div class="adminTableRowIcon">
                                                            <asp:LinkButton ID="btnDeleteMenuItem" runat="server" ToolTip='<%$ Resources:UserSite, resDelete %>'
                                                                CommandName="DeleteMenuItem" CommandArgument='<%# Eval("SiteMenuItemId") %>' OnClientClick="return confirm('Подтвердите удаление')"
                                                                CssClass="adminTableRowDelete" />
                                                        </div>
                                                    </div>
                                                </div>
                                            </li>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:Literal runat="server" ID="lSub2UlClose" Text="</ul>" />
                                        </FooterTemplate>
                                    </asp:Repeater>
                                </li>
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:Literal runat="server" ID="lSub1UlClose" Text="</ul>" />
                            </FooterTemplate>
                        </asp:Repeater>
                    </li>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Literal runat="server" ID="lUlClose" Text="</ul>" />
                </FooterTemplate>
            </asp:Repeater>
        </asp:View>
        <asp:View runat="server" ID="vMenuEdit">
            <div class="adminContent">
                <div class="fieldGrid">
                    <div class="fieldEntry">
                        <h1>Родительский узел</h1>
                        <div class="fieldEntryControl">
                            <asp:DropDownList runat="server" ID="ddlParentMenuItem" DataTextField="Title" DataValueField="SiteMenuItemId" />
                        </div>
                    </div>
                    <div class="fieldEntry">
                        <h1>Заголовок [до 80 символов]</h1>
                        <div class="fieldEntryControl">
                            <asp:TextBox runat="server" ID="txtMenuItemTitle" MaxLength="80" />
                        </div>
                    </div>
                    <div class="fieldEntry">
                        <h1>Вид страницы</h1>
                        <div class="fieldEntryControl">
                            <asp:Panel runat="server" ID="rbPageTypePanel">
                                <asp:RadioButton runat="server" ID="rbPageTypeInfo" Text="Информационный блок" GroupName="rbPageType" Checked="True" />
                                <asp:RadioButton runat="server" ID="rbPageTypeList" Text="Страница со списком" GroupName="rbPageType" />
                            </asp:Panel>
                        </div>
                    </div>
                    <asp:Panel runat="server" ID="pnlSaveChanges" CssClass="fieldEntry">
                        <div class="fieldEntryControl">
                            <asp:Button runat="server" ID="btnCancelEdit" Text="Отмена" OnClick="btnCancel_Click" />
                            <asp:Button runat="server" ID="btnSaveChangesMenuItem" Text="Сохранить" OnClick="btnSaveChangesMenuItem_Click" />
                        </div>
                    </asp:Panel>
                    <asp:Panel runat="server" ID="pnlSaveNew" CssClass="fieldEntry">
                        <div class="fieldEntryControl">
                            <asp:Button runat="server" ID="btnCancelNew" Text="Отмена" OnClick="btnCancel_Click" />
                            <asp:Button runat="server" ID="btnSaveNewMenuItem" Text="Добавить" OnClick="btnSaveNewMenuItem_Click" />
                        </div>
                    </asp:Panel>
                </div>
            </div>
        </asp:View>
    </asp:MultiView>
</asp:Content>
